{namespace vh=In2code\Powermail\ViewHelpers}
<table cellspacing="0" cellpadding="0" border="0" class="typo3-dblist">
	<tbody>

	<tr class="c-table-row-spacer">
		<td nowrap="nowrap" class="col-icon"><img width="1" height="8" alt="" src="clear.gif"></td>
		<td nowrap="nowrap" class=""><img width="230" height="1" alt="" src="clear.gif"></td>
		<td nowrap="nowrap" class=""><img width="230" height="1" alt="" src="clear.gif"></td>
		<td nowrap="nowrap" class=""><img width="230" height="1" alt="" src="clear.gif"></td>
		<td nowrap="nowrap" class=""><img width="230" height="1" alt="" src="clear.gif"></td>
		<td nowrap="nowrap" class="" width="10"><img width="1" height="1" alt="" src="clear.gif"></td>
	</tr>
	<tr class="t3-row-header">
		<td nowrap="nowrap" class="col-icon">&nbsp;</td>
		<td nowrap="nowrap" colspan="5">
								<span class="c-table">
									<f:translate key="BackendListMails" />
								</span>
			(<f:count subject="{mails}" />)
		</td>
		<td nowrap="nowrap" class="col-icon">&nbsp;</td>
	</tr>
	<tr class="c-headLine">
		<td nowrap="nowrap" class="col-icon">
		</td>
		<td nowrap="nowrap" class="col-title">
			<f:if condition="{piVars.sorting.crdate}">
				<f:then>
					<f:if condition="{0 : piVars.sorting.crdate} == {0 : 'desc'}">
						<f:then>
							<f:link.action additionalParams="{tx_powermail_web_powermailm1: {sorting: {crdate: 'asc'}}}" class="sorting sorting_desc">
								<f:translate key="\In2code\Powermail\Domain\Model\Mail.date" />
							</f:link.action>
						</f:then>
						<f:else>
							<f:link.action additionalParams="{tx_powermail_web_powermailm1: {sorting: {crdate: 'desc'}}}" class="sorting sorting_asc">
								<f:translate key="\In2code\Powermail\Domain\Model\Mail.date" />
							</f:link.action>
						</f:else>
					</f:if>
				</f:then>
				<f:else>
					<f:link.action additionalParams="{tx_powermail_web_powermailm1: {sorting: {crdate: 'asc'}}}" class="sorting">
						<f:translate key="\In2code\Powermail\Domain\Model\Mail.date" />
					</f:link.action>
				</f:else>
			</f:if>
		</td>
		<td nowrap="nowrap" class="col-title">
			<strong>
				<f:translate key="\In2code\Powermail\Domain\Model\Mail.datetime" />
			</strong>
		</td>
		<td nowrap="nowrap" class="col-title">
			<strong>
				<f:translate key="\In2code\Powermail\Domain\Model\Mail.senderName" />
			</strong>
		</td>
		<td nowrap="nowrap" class="col-title">
			<strong>
				<f:translate key="\In2code\Powermail\Domain\Model\Mail.senderMail" />
			</strong>
		</td>
		<td nowrap="nowrap" class="col-title">
			<f:if condition="{piVars.sorting.subject}">
				<f:then>
					<f:if condition="{0 : piVars.sorting.subject} == {0 : 'desc'}">
						<f:then>
							<f:link.action additionalParams="{tx_powermail_web_powermailm1: {sorting: {subject: 'asc'}}}" class="sorting sorting_desc">
								<f:translate key="\In2code\Powermail\Domain\Model\Mail.subject" />
							</f:link.action>
						</f:then>
						<f:else>
							<f:link.action additionalParams="{tx_powermail_web_powermailm1: {sorting: {subject: 'desc'}}}" class="sorting sorting_asc">
								<f:translate key="\In2code\Powermail\Domain\Model\Mail.subject" />
							</f:link.action>
						</f:else>
					</f:if>
				</f:then>
				<f:else>
					<f:link.action additionalParams="{tx_powermail_web_powermailm1: {sorting: {subject: 'asc'}}}" class="sorting">
						<f:translate key="\In2code\Powermail\Domain\Model\Mail.subject" />
					</f:link.action>
				</f:else>
			</f:if>
		</td>
		<td nowrap="nowrap" class="col-icon"></td>
	</tr>

	<f:for each="{mailsPage}" as="mail">
		<tr class="db_list_normal firstcol powermail_listbe_overview">
			<td nowrap="nowrap" class="col-icon">
				<span class="t3-icon t3-icon-tcarecords t3-icon-tcarecords-tx_powermail_domain_model_mails t3-icon-tx_powermail_domain_model_mails-default{f:if(condition:'{mail.hidden}',then:' transparent')}" title="id={mail.uid}">&nbsp;</span>
			</td>
			<td nowrap="nowrap" class="col-title">
				<f:format.date format="{f:translate(key:'datepicker_format_date')}">{mail.crdate}</f:format.date>
			</td>
			<td nowrap="nowrap" class="col-title">
				<f:format.date format="{f:translate(key:'datepicker_format_time')}">{mail.crdate}</f:format.date>
			</td>
			<td nowrap="nowrap" class="col-title">
				<span title="{mail.senderName}">
					<f:format.crop maxCharacters="50" append="&nbsp;[...]">{mail.senderName}</f:format.crop>
				</span>
			</td>
			<td nowrap="nowrap" class="col-title">
				<span title="{mail.senderMail}">
					<f:format.crop maxCharacters="50" append="&nbsp;[...]">{mail.senderMail}</f:format.crop>
				</span>
			</td>
			<td nowrap="nowrap" class="col-title">
				<span title="{mail.subject}">
					<f:format.crop maxCharacters="60" append="&nbsp;[...]">{mail.subject}</f:format.crop>
				</span>
			</td>
			<td nowrap="nowrap" class="">
				<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-view openPowermailDetails" title="{f:translate(key: 'BackendListHelpDetails')}">&nbsp;</span>

				<a title="{f:translate(key: 'BackendListHelpEdit')}" href="{vh:Misc.BackendEditLink(tableName:'tx_powermail_domain_model_mails',identifier:mail.uid)}">
					<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-open">&nbsp;</span>
				</a>

				<span class="t3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-delete deleteMail" title="{f:translate(key:'BackendListMailDelete')}">&nbsp;</span>

				<f:if condition="{mail.hidden}">
					<f:then>
						<span title="{f:translate(key: 'BackendListHelpUnhide')}" class="t3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-unhide hideMail">&nbsp;</span>
					</f:then>
					<f:else>
						<span title="{f:translate(key: 'BackendListHelpHide')}" class="t3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-hide unhideMail">&nbsp;</span>
					</f:else>
				</f:if>

				<input type="hidden" class="container_uid" name="container_uid" value="{mail.uid}" />
				<input type="hidden" class="container_formtoken" name="container_formtoken" value="{token}" />
				<input type="hidden" class="container_table" name="container_table" value="tx_powermail_domain_model_mails" />
				<input type="hidden" class="container_label_delete_confirmation" name="container_label_delete_confirmation" value="{f:translate(key:'BackendListMailDeleteConfirmation')}" />
			</td>
		</tr>
		<tr class="db_list_normal powermail_listbe_details powermail_listbe_details_closed">
			<td colspan="7">
				<div class="powermail_listbe_details_container">
					<f:for each="{mail.answers}" as="answer">
						<f:if condition="{answer.value}">
							<dl class="powermail_listbe_details_dl">
								<dt>
									<f:if condition="{answer.field.title}">
										<f:then>
											<strong>{answer.field.title}:</strong>
										</f:then>
										<f:else>
											<strong>No Label:</strong>
										</f:else>
									</f:if>
								</dt>
								<dd class="powermail_listbe_details_dd powermail_listbe_details_type_{answer.field.type}">
									<f:comment>Data Type String</f:comment>
									<f:if condition="{answer.valueType} == 0">
										<f:format.nl2br>{answer.value}</f:format.nl2br>
									</f:if>

									<f:comment>Data Type Array</f:comment>
									<f:if condition="{answer.valueType} == 1">
										<vh:String.ImplodeField objects="{answer.value}" separator=", " />
									</f:if>

									<f:comment>Data Type Date (already parsed Timestamp by Model)</f:comment>
									<f:if condition="{answer.valueType} == 2">
										{answer.value}
									</f:if>

									<f:comment>Data Type Fileupload</f:comment>
									<f:if condition="{answer.valueType} == 3">
										<f:for each="{answer.value}" as="subValue" iteration="uploadIndex">
											<a href="{vh:Misc.Link(path:'{vh:Misc.GetFileWithPath(path:\'{settings.uploadPath}\',fileName:\'{subValue}\')}', absolute:1)}" title="{settings.uploadPath}{subValue}" target="_blank">
												<f:if condition="{vh:Condition.IsImage(path:subValue)}">
													<f:then>
														<f:if condition="{vh:Condition.FileExists(file:'{vh:Misc.GetFileWithPath(path:\'{settings.uploadPath}\',fileName:\'{subValue}\')}')}">
															<f:then>
																<f:image src="{vh:Misc.GetFileWithPath(path:'{settings.uploadPath}',fileName:'{subValue}')}" alt="{subValue}" width="200" maxHeight="200" />
															</f:then>
															<f:else>
																File does not exist
															</f:else>
														</f:if>
													</f:then>
													<f:else>
														{subValue}
													</f:else>
												</f:if>
											</a>
											<br />
										</f:for>
									</f:if>
								</dd>
							</dl>
						</f:if>
					</f:for>
					<f:if condition="{mail.spamFactor} != '0%'">
						<dl class="powermail_listbe_details_dl powermail_listbe_details_dl_additional">
							<dt>
								<strong><f:translate key="\In2code\Powermail\Domain\Model\Mail.spamFactor" default="Spamfactor" /></strong>
							</dt>
							<dd>
								{mail.spamFactor}
							</dd>
						</dl>
					</f:if>
					<f:if condition="{vh:Condition.IsMarketingInformationEnabledGlobally()}">
						<f:if condition="{mail.marketingRefererDomain}">
							<dl class="powermail_listbe_details_dl powermail_listbe_details_dl_additional">
								<dt>
									<strong><f:translate key="\In2code\Powermail\Domain\Model\Mail.marketingRefererDomain" default="marketingRefererDomain" /></strong>
								</dt>
								<dd>
									{mail.marketingRefererDomain}
								</dd>
							</dl>
						</f:if>
						<f:if condition="{mail.marketingReferer}">
							<dl class="powermail_listbe_details_dl powermail_listbe_details_dl_additional">
								<dt>
									<strong><f:translate key="\In2code\Powermail\Domain\Model\Mail.marketingReferer" default="marketingReferer" /></strong>
								</dt>
								<dd>
									{mail.marketingReferer}
								</dd>
							</dl>
						</f:if>
						<f:if condition="{mail.marketingCountry}">
							<dl class="powermail_listbe_details_dl powermail_listbe_details_dl_additional">
								<dt>
									<strong><f:translate key="\In2code\Powermail\Domain\Model\Mail.marketingCountry" default="marketingCountry" /></strong>
								</dt>
								<dd>
									{mail.marketingCountry}
								</dd>
							</dl>
						</f:if>
						<f:if condition="{mail.marketingMobileDevice}">
							<f:comment>Use marketingPageFunnel as indicator if marketing is switched on in generally - showing "0" is ok</f:comment>
							<dl class="powermail_listbe_details_dl powermail_listbe_details_dl_additional">
								<dt>
									<strong><f:translate key="\In2code\Powermail\Domain\Model\Mail.marketingMobileDevice" default="marketingMobileDevice" /></strong>
								</dt>
								<dd>
									{mail.marketingMobileDevice}
								</dd>
							</dl>
						</f:if>
						<f:if condition="{mail.marketingPageFunnel}">
							<f:comment>Use marketingPageFunnel as indicator if marketing is switched on in generally - showing "0" is ok</f:comment>
							<dl class="powermail_listbe_details_dl powermail_listbe_details_dl_additional">
								<dt>
									<strong><f:translate key="\In2code\Powermail\Domain\Model\Mail.marketingFrontendLanguage" default="marketingFrontendLanguage" /></strong>
								</dt>
								<dd>
									{mail.marketingFrontendLanguage}
								</dd>
							</dl>
						</f:if>
						<f:if condition="{mail.marketingBrowserLanguage}">
							<dl class="powermail_listbe_details_dl powermail_listbe_details_dl_additional">
								<dt>
									<strong><f:translate key="\In2code\Powermail\Domain\Model\Mail.marketingBrowserLanguage" default="marketingBrowserLanguage" /></strong>
								</dt>
								<dd>
									{mail.marketingBrowserLanguage}
								</dd>
							</dl>
						</f:if>
						<f:if condition="{mail.marketingPageFunnel}">
							<dl class="powermail_listbe_details_dl powermail_listbe_details_dl_additional">
								<dt>
									<strong><f:translate key="\In2code\Powermail\Domain\Model\Mail.marketingPageFunnel" /></strong>
								</dt>
								<dd>
									<f:for each="{mail.marketingPageFunnel}" as="page" iteration="index">
										<span title="id={page}"><vh:Getter.GetPageNameFromUid uid="{page}" /></span> <f:if condition="{index.isLast}"><f:else> &gt; </f:else></f:if>
									</f:for>
								</dd>
							</dl>
						</f:if>
					</f:if>
				</div>
			</td>
		</tr>

	</f:for>

	</tbody>
</table>